package com.zwz.service.impl;

import com.zwz.entity.EnterpriseInfo;
import com.zwz.entity.TaxpayerQuali;
import com.zwz.mapper.TaxpayerQualiMapper;
import com.zwz.service.TaxpayerQualiService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@RequiredArgsConstructor
public class TaxpayerQualiServiceImpl implements TaxpayerQualiService {
    private final TaxpayerQualiMapper mapper;

    @Override
    @Transactional
    public void create(TaxpayerQuali entity, String pk) {
        // 创建主表记录
        EnterpriseInfo enterpriseInfo=new EnterpriseInfo();
//        enterpriseInfo.setId(Long.valueOf(entity.getEnterpriseId()));

        entity.setEnterpriseId(Integer.valueOf(pk));

        mapper.insert(entity);
    }

    @Override
    @Transactional
    public void delete(Integer id) {
        mapper.deleteById(id);
    }

    @Override
    @Transactional
    public void update(TaxpayerQuali entity) {
        mapper.update(entity);
    }

    @Override
    public TaxpayerQuali getById(Integer id) {
        return mapper.selectById(id);
    }

    @Override
    public List<TaxpayerQuali> getAll() {
        return mapper.selectAll();
    }
}